//
//  QYDateCell.swift
//  QingYuJSQ
//
//  Created by 李东 on 2024/4/5.
//

import UIKit
import FSCalendar

class QYDateCell: FSCalendarCell {
    
    lazy var emImgView = UIImageView()
    static let CellID = NSStringFromClass(QYDateCell.self)

    override init!(frame: CGRect) {
        super.init(frame: frame)
        contentView.addSubview(emImgView)
        emImgView.snp.makeConstraints { make in
            make.top.centerX.equalToSuperview()
            make.size.equalTo(shapeLayer.frame.size)
        }
    }
    
    required init!(coder aDecoder: NSCoder!) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
 
    }
    
    
    override func layoutSubviews() {
        super.layoutSubviews()
        emImgView.snp.remakeConstraints { make in
            make.centerX.equalToSuperview()
            make.size.equalTo(shapeLayer.frame.size)
            make.centerY.equalTo(shapeLayer.frame.midY)
        }
    }

    var img: UIImage? {
        didSet {
            guard let temp = img else {
                emImgView.isHidden = true
                return
            }
            emImgView.isHidden = false
            emImgView.image = temp
            
        }
    }
  
}
